﻿using FileEfCore.DbContexts;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.Extensions.Hosting;

public static class WebApplicationExtensions
{
    public static void InitializeDb(this WebApplication app)
    {
        using var scope = app.Services.CreateScope();
        var context = scope.ServiceProvider.GetRequiredService<FileDbContext>();
        context.Database.EnsureCreated();
    }
}